package com.bert.thymeleafgenerator.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class IndexController {

    @RequestMapping({"/", "/index"})
    public String index() {
        return "index";
    }

    @RequestMapping("/test")
    public String test(@RequestParam("n1") String n1, @RequestParam("n2") String n2, Model model) {
        if (n1 == "q"){
            return "index";
        }
        model.addAttribute("msg", "密码错误");
        return "test";
    }

    @RequestMapping("/test404")
    public String test404() {
        return "index";
    }

    @RequestMapping("/test500")
    public String test500() {
        int i = 1 / 0;
        return "index";
    }
}
